//
//  SearchSongTableCell.m
//  Coco_Music
//
//  Created by 强哥 on 15/6/24.
//  Copyright (c) 2015年 寇广超. All rights reserved.
//

#import "SearchSongTableCell.h"
#import "UIImageView+WebCache.h"

@implementation SearchSongTableCell

-(void)dealloc
{
    [self.searchSongInfo release];
    [self.TitleLabel release];
    [self.SongNumberLabel release];
    [self.SingerImage release];
    [self.ImageLine release];
    [super dealloc];
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self creation];
    }
    return self;
}
//歌单自定义cell
-(void)creation
{
    self.SingerImage = [[UIImageView alloc]initWithFrame:CGRectMake(self.frame.origin.x+10, self.frame.origin.y+10, 100, 100)];
    self.SingerImage.layer.masksToBounds = YES;
    self.SingerImage.layer.cornerRadius = 10;
    self.TitleLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.SingerImage.frame.size.width+30, self.frame.origin.y+20, [UIScreen mainScreen].bounds.size.width-self.SingerImage.frame.size.width-30, 60)];
    self.TitleLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.SingerImage.frame.origin.x+120, self.frame.origin.y+20, [UIScreen mainScreen].bounds.size.width - self.SingerImage.frame.origin.x - 120, 30)];
    self.TitleLabel.font = [UIFont fontWithName:@"Menlo-Bold" size:18];
    self.TitleLabel.numberOfLines = 2;
    self.ImageLine = [[UIImageView alloc]initWithFrame:CGRectMake(_SingerImage.frame.size.width+20, _SingerImage.frame.size.height+2+10, [UIScreen mainScreen].bounds.size.width-_SingerImage.frame.size.width-40, 1)];
    _ImageLine.backgroundColor = [UIColor lightGrayColor];
    [self.contentView addSubview:_SingerImage];
    [self.contentView addSubview:_TitleLabel];
    [self.contentView addSubview:self.ImageLine];
    [self.SingerImage release];
    [self.TitleLabel release];
    [self.ImageLine release];
}

-(void)setSearchSongInfo:(SearchSong *)searchSongInfo
{
    if (_searchSongInfo != searchSongInfo) {
        [_searchSongInfo release];
        _searchSongInfo = [searchSongInfo retain];
    }
    self.TitleLabel.text = searchSongInfo.title;
    
    NSString *string = searchSongInfo.pic_url;
    NSURL *url = [NSURL URLWithString:string];
    [self.SingerImage sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"cm2_default_artist_banner-1"]];
}












- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
